﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MicropleSoft.WmsServiceLibrary.Domain;
using MicropleSoft.WmsServiceLibrary.Menu;
using MicropleSoft.WmsServiceLibrary.Models;

namespace MicropleSoft.Web
{
    [ServiceContract]
    public partial interface IServiceFacade
    {
        #region security
        /// <summary>
        /// 登陆系统，获取token
        /// </summary>
        /// <param name="userId">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="whId">仓库代码</param>
        /// <returns>token或者异常信息，格式："success:badstebdsfkopperqeirwqr" 或者："exception:用户名错误"</returns>
        [OperationContract]
        String Login(string userId, string password, string whId);

        [OperationContract]
        Dictionary<string, string> GetLoginInfo(string token);

        [OperationContract]
        WmsUser GetSystemUser(string userId);

        [OperationContract]
        string ChangePassword(string userId, string oldPassword, string newPassword);

        [OperationContract]
        string SetPassword(string userId, string newPassword);

        [OperationContract]
        void SaveWmsUsers(List<WmsUser> wmsUsers);

        [OperationContract(Name = "SaveWmsUsers2")]
        void SaveWmsUsers(List<WmsUser> wmsUsers, List<string> notUpdateProperties);

        [OperationContract]
        List<WmsUser> QueryWmsUsers(string condition);
        #endregion

        #region Role
        [OperationContract]
        List<Role> QueryRoles(string condition);

        [OperationContract]
        void SaveRoles(List<Role> roles);
        #endregion

        #region Menu
        [OperationContract]
        List<MenuItemModel> GetMenuItemModels();
        #endregion

        #region WhConfig
        [OperationContract]
        List<WhConfig> GetWhConfigList(string condition);

        [OperationContract]
        List<MenuList> GetMenuLists(string condition);
        #endregion

        #region LocationManage

        [OperationContract]
        List<Area> GetAreaList(string condition);

        [OperationContract]
        void SaveAreas(List<Area> areas);

        [OperationContract(Name = "SaveAreasIncludeNotUpdateProperties")]
        void SaveAreas(List<Area> areas, List<String> notUpdateProperties);

        [OperationContract]
        List<AreaDetail> GetAreaDetailList(string condition);

        [OperationContract]
        void SaveAreaDetails(List<AreaDetail> areaDetails);

        [OperationContract(Name = "SaveAreaDetailsIncludeNotUpdateProperties")]
        void SaveAreaDetails(List<AreaDetail> areaDetails, List<String> notUpdateProperties);

        [OperationContract]
        List<Location> GetLocationList(string condition);

        [OperationContract]
        void SaveLocations(List<Location> locations);

        [OperationContract(Name = "SaveLocationsIncludeNotUpdateProperties")]
        void SaveLocations(List<Location> locations, List<String> notUpdateProperties);

        [OperationContract]
        List<LocationTemplate> GetLocationTemplateList(string condition);

        [OperationContract]
        void SaveLocationTemplates(List<LocationTemplate> locationTemplates);

      [OperationContract(Name = "SaveLocationTemplatesIncludeNotUpdateProperties")]
        void SaveLocationTemplates(List<LocationTemplate> locationTemplates, List<String> notUpdateProperties);

        [OperationContract]
        List<Zone> GetZoneList(string condition);

        [OperationContract]
        void SaveZones(List<Zone> zones);

        [OperationContract(Name = "SaveZonesIncludeNotUpdateProperties")]
        void SaveZones(List<Zone> zones, List<String> notUpdateProperties);

        #endregion

        #region BaseDataAndService

        [OperationContract]
        List<BillingEntity> GetBillingEntityList(string condition);

        [OperationContract]
        void SaveBillingEntitys(List<BillingEntity> billingEntitys);

        [OperationContract(Name = "SaveBillingEntitysIncludeNotUpdateProperties")]
        void SaveBillingEntitys(List<BillingEntity> billingEntitys, List<String> notUpdateProperties);

        [OperationContract]
        List<Carrier> GetCarrierList(string condition);

        [OperationContract]
        void SaveCarriers(List<Carrier> carriers);

        [OperationContract(Name = "SaveCarriersIncludeNotUpdateProperties")]
        void SaveCarriers(List<Carrier> carriers, List<String> notUpdateProperties);

        [OperationContract]
        List<Customer> GetCustomerList(string condition);

        [OperationContract]
        void SaveCustomers(List<Customer> customers);

        [OperationContract(Name = "SaveCustomersIncludeNotUpdateProperties")]
        void SaveCustomers(List<Customer> customers, List<String> notUpdateProperties);

        [OperationContract]
        List<Owner> GetOwnerList(string condition);

        [OperationContract]
        void SaveOwners(List<Owner> owners);

        [OperationContract(Name = "SaveOwnersIncludeNotUpdateProperties")]
        void SaveOwners(List<Owner> owners, List<String> notUpdateProperties);

        [OperationContract]
        List<Vendor> GetVendorList(string condition);

        [OperationContract]
        void SaveVendors(List<Vendor> vendors);

        [OperationContract(Name = "SaveVendorsIncludeNotUpdateProperties")]
        void SaveVendors(List<Vendor> vendors, List<String> notUpdateProperties);


        [OperationContract]
        List<Pack> GetPackList(string condition);

        [OperationContract]
        void SavePacks(List<Pack> packs);

        [OperationContract]
        List<Organization> GetOrganizationList(string condition);

        [OperationContract]
        void SaveOrganizations(List<Organization> organizations);
        
        [OperationContract]
        List<BillClass> GetBillClassList(string condition);

        [OperationContract]
        void SaveBillClasss(List<BillClass> billClasss);

        [OperationContract(Name = "SaveBillClasssIncludeNotUpdateProperties")]
        void SaveBillClasss(List<BillClass> billClasss, List<String> notUpdateProperties);

        [OperationContract]
        List<BillTemplate> GetBillTemplateList(string condition);

        [OperationContract]
        void SaveBillTemplates(List<BillTemplate> billTemplates);

        [OperationContract(Name = "SaveBillTemplatesIncludeNotUpdateProperties")]
        void SaveBillTemplates(List<BillTemplate> billTemplates, List<String> notUpdateProperties);

        [OperationContract]
        List<BillTemplateEntry> GetBillTemplateEntryList(string condition);

        [OperationContract]
        void SaveBillTemplateEntrys(List<BillTemplateEntry> billTemplateEntrys);

        [OperationContract(Name = "SaveBillTemplateEntrysIncludeNotUpdateProperties")]
        void SaveBillTemplateEntrys(List<BillTemplateEntry> billTemplateEntrys, List<String> notUpdateProperties);

        [OperationContract]
        List<ItemClass> GetItemClassList(string condition);

        [OperationContract]
        void SaveItemClasss(List<ItemClass> itemClasss);

        [OperationContract(Name = "SaveItemClasssIncludeNotUpdateProperties")]
        void SaveItemClasss(List<ItemClass> itemClasss, List<String> notUpdateProperties);

        [OperationContract]
        List<ItemTemplate> GetItemTemplateList(string condition);

        [OperationContract]
        void SaveItemTemplates(List<ItemTemplate> itemTemplates);

        [OperationContract(Name = "SaveItemTemplatesIncludeNotUpdateProperties")]
        void SaveItemTemplates(List<ItemTemplate> itemTemplates, List<String> notUpdateProperties);

        [OperationContract]
        List<ItemNode> GetItemNodeList(string condition);

        [OperationContract]
        void SaveItemNodes(List<ItemNode> itemNodes);

        [OperationContract(Name = "SaveItemNodesIncludeNotUpdateProperties")]
        void SaveItemNodes(List<ItemNode> itemNodes, List<String> notUpdateProperties);

        [OperationContract]
        List<ItemClassKind> GetItemClassKindList(string condition);

        [OperationContract]
        void SaveItemClassKinds(List<ItemClassKind> itemClassKinds);

        [OperationContract(Name = "SaveItemClassKindsIncludeNotUpdateProperties")]
        void SaveItemClassKinds(List<ItemClassKind> itemClassKinds, List<String> notUpdateProperties);
        #endregion

        #region MetaDataHandle
        [OperationContract]
        DataTableWrap GetStaticDataTableWrapByItemClass(string classNumber);

        [OperationContract(Name = "GetStaticDataTableWrapByItemClass2")]
        DataTableWrap GetStaticDataTableWrapByItemClass(string classNumber,string dataTableCondition);

        [OperationContract]
        void SaveStaticDataTable(DataTableWrap dataTableWrap);

        #endregion

        #region SaveOrQueryDataTable(DataSet)

        [OperationContract]
        DataTable QueryDataTable(string tableName, string condition);

        [OperationContract]
        DataTable SaveDataTable(string tableName, DataTable dataTable);

        [OperationContract]
        DataSet QueryDataSet(List<string> queryStrings);

        [OperationContract]
        DataSet SaveDataSet(DataSet dataSet);

        [OperationContract]
        int GetMaxValue(string identityName);

        [OperationContract]
        int GetBillNumber(string numberName, string whId, int year, int month, int day);
        #endregion 

        #region PurchaseOrder

        [OperationContract]
        List<PurchaseOrder> GetPurchaseOrderList(string condition);

        [OperationContract]
        void SavePurchaseOrders(List<PurchaseOrder> purchaseOrders);

        [OperationContract(Name = "SavePurchaseOrdersIncludeNotUpdateProperties")]
        void SavePurchaseOrders(List<PurchaseOrder> purchaseOrders, List<String> notUpdateProperties);

        [OperationContract]
        List<PurchaseOrderDetail> GetPurchaseOrderDetailList(string condition);

        [OperationContract]
        void SavePurchaseOrderDetails(List<PurchaseOrderDetail> purchaseOrderDetails);

        [OperationContract(Name = "SavePurchaseOrderDetailsIncludeNotUpdateProperties")]
        void SavePurchaseOrderDetails(List<PurchaseOrderDetail> purchaseOrderDetails, List<String> notUpdateProperties);

        [OperationContract]
        void SavePurchaseOrderWrap(PurchaseOrderWrap purchaseOrderWrap);

        [OperationContract]
        PurchaseOrderWrap GetPurchaseOrderWrapByPo(string poId, string whId);

        #endregion
    }
}
